import * as Cesium from 'cesium'
import * as THREE from 'three'
export class ModelUtils {
    static fixXYtoCesium(model) {
        model.rotation.y = Math.PI / 2
        model.rotation.x = Math.PI / 2
        model.updateMatrix()
    }

    static getThreeMatrix4FromDegrees(longitude, latitude, height) {
        const cesiumMatrix4 = Cesium.Transforms.eastNorthUpToFixedFrame(
            Cesium.Cartesian3.fromDegrees(longitude, latitude, height)
        )

        const Matrix4Array = Cesium.Matrix4.toArray(cesiumMatrix4)
        const threeMatrix4 = new THREE.Matrix4().fromArray(Matrix4Array)
        return threeMatrix4
    }
}
